import os
import unittest
from testcase.shopping import Shopping
from tools.HwTestReport import HTMLTestReport

# 构建用例套件-确定要执行的测试用例
suite = unittest.TestSuite()
# 加载要执行的测试用例
suite.addTest(Shopping('test_add_cart'))
suite.addTest(Shopping('test_default_address'))

# 创建报告文件
report = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../result/report.html')
with open(report, 'wb') as report_file:
    # 使用报告文件创建用例执行器
    runner = HTMLTestReport(report_file,
                            title='报告标题',
                            description='报告描述',
                            # images=True, # 截图
                            tester='测试人员')

    # 执行用例
    runner.run(suite)
